import tensorflow as tf

class MyDense(tf.keras.layers.Layer):
    def __init__(self, n_outputs):
        super(MyDense, self).__init__()
        self.n_outputs = n_outputs

    def build(self, input_shape):
        print(input_shape,"......hhhh..........")
        self.kernel = self.add_variable('kernel',
                                       shape=[int(input_shape[-1]),
                                             self.n_outputs])
    def call(self, input):
        print(input)
        return tf.matmul(input, self.kernel)



layer = MyDense(10)
print(layer(tf.ones([6, 5])))
print(layer.trainable_variables)